package me.zhengjie.service.impl;

import lombok.RequiredArgsConstructor;
import me.zhengjie.domain.ErpChunk;
import me.zhengjie.repository.FzChunkRepository;
import me.zhengjie.service.FzChunkService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@RequiredArgsConstructor
public class FzChunkServiceImpl implements FzChunkService {

    private final FzChunkRepository fzChunkRepository;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void save(ErpChunk chunk) {
        fzChunkRepository.save(chunk);
    }

    @Override
    public List<ErpChunk> findByIdentifier(String identifier) {
        return fzChunkRepository.findByIdentifier(identifier);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteByBid(String bid) {
        return fzChunkRepository.deleteByBid(bid);
    }
}
